CON

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  

obj

  motor         : "Eddie Motor Driver"

var


pub go | i

  'Start the Eddie motor driver object
  motor.Start

  'ramp through some motor speeds
  repeat i from -100 to 100
    SetLeft(i)
    SetRight(-i)
    waitcnt(cnt + clkfreq/20)

  'Leave both motors stopped  
  SetLeft(0)
  SetRight(0)

  'All done
  
pub SetLeft(percentage)
'Sets the left motor's speed value.
'Range: -100 and 100 percent.

  motor.Left((motor#MAX_ON_TIME*percentage)/100)        'scale the percentage value to a number of microseconds

pub SetRight(percentage)

  motor.Right((motor#MAX_ON_TIME*percentage)/100)
  